package com.jsh.frame.myframe2.activity;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;

import com.jsh.frame.myframe2.R;
import com.jsh.frame.myframe2.fragment.HeadFragment;
import com.jsh.frame.myframe2.fragment.InfoFragment;

import butterknife.BindView;

/**
 * 简历界面
 **/
public class ResumeActivity extends BaseActivity {
    @BindView(R.id.view_pager)
    ViewPager viewPager;

    private Fragment[] fragments;

    @Override
    int getContentRes() {
        return R.layout.activity_resume;
    }

    @Override
    void initView() {
        fragments = new Fragment[]{new HeadFragment(),new InfoFragment()};
        FragmentPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager(), fragments);
        viewPager.setAdapter(pagerAdapter);

    }

    @Override
    void initData() {

    }

    private class MyPagerAdapter extends FragmentPagerAdapter {
        private Fragment[] fragments;

        public MyPagerAdapter(FragmentManager fm, Fragment[] fragments) {
            super(fm);
            this.fragments = fragments;
        }

        @Override
        public Fragment getItem(int position) {
            return fragments[position];
        }

        @Override
        public int getCount() {
            return fragments.length;
        }
    }
}
